class Rating < ActiveRecord::Base
    validates_presence_of :performance, :improvement, :hours
    validates_numericality_of :hours
#    errors.add(:hours, "Not valid: hours must be greater than zero") if :hours.nil? || :hours < 0.0


	def self.showRates()
        result = ""
        @rates = find(:all, :order => "created_at")
        result += "<ul>"
        @rates.each{ |rate|
            result += "<li>"
            result += "submitted on: " + rate.created_at.to_s + "<br /><ul>"
            result += "<li><b><i>How did the professor perform?</i></b> " + rate.performance.to_s + "<br /></li>"
            result += "<li><b><i>The course could be improved by:</i></b> " + rate.improvement.to_s + "<br /></li>"
            result += "<li>I spent about <b>" + rate.hours.to_s + "</b> hours on this class weekly.<br /></li></ul>"
            result += "</li>"
            result += "<br />"
        }
        result += "</ul>"
        result
	end

end
